<!--
 * @Author: xfworld
 * @Date: 2020-03-13 15:56:17
 * @LastEditors: xfworld
 * @LastEditTime: 2020-06-11 10:46:09
 * @Description: 
 -->
<template>
  <div id="app">
    <transition>
      <router-view />
    </transition>
  </div>
</template>
<script>
import {mapGetters, mapActions} from "vuex";

export default {
  name: "mainApp",
  components: {},
  created() {
    document.addEventListener("deviceready", this.onDeviceReady, false);
  },
  computed: {
    ...mapGetters("scanner", ["pdaUseEnable", "pdaScanner"])
  },
  methods: {
    ...mapActions("scanner", ["initScanEvent", "scanSuccessEvent", "scanFailEvent"]),
    onDeviceReady() {
      this.initScanEvent(this.$config.scanner);
      if (this.pdaUseEnable) {
        this.pdaScanner.nativeListen(window.plugins, this.scanSuccessEvent, this.scanFailEvent);
      }
    }
  }
};
</script>
<style lang="less" scoped>
html,
body,
#app {
  width: 100%;
  height: 100%;
}
#app {
  display: flex;
  flex-direction: column;
}
</style>
